import pygame,sys
import os

pygame.init()
pygame.mixer.init()
src = pygame.display.set_mode([800,600])
pygame.time.delay(1000)

path = '1760'
n1 = pygame.mixer.Sound(os.path.join(path, '1.wav'))
n2 = pygame.mixer.Sound(os.path.join(path, '2.wav'))
n3 = pygame.mixer.Sound(os.path.join(path, '3.wav'))
n4 = pygame.mixer.Sound(os.path.join(path, '4.wav'))
n5 = pygame.mixer.Sound(os.path.join(path, '5.wav'))
n6 = pygame.mixer.Sound(os.path.join(path, '6.wav'))
n7 = pygame.mixer.Sound(os.path.join(path, '7.wav'))

notemap = {1:n1,2:n2,3:n3,4:n4,5:n5,6:n6,7:n7}

notes = [3,3,4,5
         ,5,4,3,2
         ,1,1,2,3
         ,3,2,2
         ,3,3,4,5
         ,5,4,3,2
         ,1,1,2,3
         ,2,1,1
         ,2,2,3,1
         ,2,3,4,3,1
         ,2,3,4,3,2
         ,1,2,5,3
         ,3,3,4,5
         ,5,4,3,4,2
         ,1,1,2,3
         ,2,1,1
         ]
    
durt = [ #duration
    1,1,1,1
    ,1,1,1,1
    ,1,1,1,1
    ,1+0.5,0.5,1+1
    ,1,1,1,1
    ,1,1,1,1
    ,1,1,1,1
    ,1+0.5,0.5,1+1
    ,1,1,1,1
    ,1,0.2,0.2,1,1
    ,1,0.2,0.2,1,1
    ,1,1+0.5,1,1
    ,1,1,1,1
    ,1,1,1,0.2,0.2
    ,1,1,1,1
    ,1+0.5,0.5,1+1
    ]

length = len(notes)
if len(durt) != length:
    print 'error:not equal length!!!'
    sys.exit()
    
for idx in range(length):
    print 'idx:',idx,
    print 'note:',notes[idx],
    print 'duration',durt[idx]
    notemap[notes[idx]].play()
    pygame.time.delay(int(500*durt[idx]))
        


print 'program done'


'''
notes = [
    n3,n3,n4,n5/
    n5,n4,n3,n2/
    n1,n1,n2,n3/
    n3,n2,n2/
    n3,n3,n4,n5/
    n5,n4,n3,n2/
    n1,n1,n2,n3/
    n2,n1,n1/
    n2,n2,n3,n1/
    n2,n3,n4,n3,n1/
    n2,n3,n4,n3,n2/
    n1,n2,n5,n3/
    n3,n3,n4,n3/
    n5,n4,n3,n3,n2/
    n1,n1,n2,n3/
    n2,n1,n1
    ]
    '''
'''
notes = [
    n3,n3,n4,n5/
    n5,n4,n3,n2/
    n1,n1,n2,n3/
    n3,n2,n2/
    n3,n3,n4,n5/
    n5,n4,n3,n2/
    n1,n1,n2,n3/
    n2,n1,n1/
    n2,n2,n3,n1/
    n2,n3,n4,n3,n1/
    n2,n3,n4,n3,n2/
    n1,n2,n5,n3/
    n3,n3,n4,n3/
    n5,n4,n3,n3,n2/
    n1,n1,n2,n3/
    n2,n1,n1
    ]
    '''
